<template>
	<view>
		<uni-card margin="18rpx">
			<uni-list-item :border="false" title="创建文章" link to="/pages/EditArticle/EditArticle"></uni-list-item>
		</uni-card>
		<view class="my_article">
			<uni-section title="我的文章" type="line"></uni-section>
		</view>
		<ArticleList :key="token" v-if="token" :type_id="type_id"></ArticleList>
		<view v-else class="no_login">
			请先去登录
		</view>
	</view>
</template>

<script setup>
	import {onShow} from '@dcloudio/uni-app'
	import ArticleList from '@/components/ArticleList/ArticleList.vue'
	import {userStore} from '@/stores/user.js'
	import { onMounted , ref, watch} from "vue";
	const userstore = userStore()
	const type_id=ref({type:'self',id:'self'})
	const token=ref(uni.getStorageSync('token'))
	onShow(()=>{
		token.value=uni.getStorageSync('token')
		if(token.value) token.value+=Math.random()
		console.log('展示了')
	})
</script>

<style lang="less">
	.create_box{
		padding: 10rpx;
	}
	.my_article{
		margin: 16rpx;
	}
	.no_login{
		color: #43A047;
		font-size: 16rpx;
		display: flex;
		justify-content: center;
	}
</style>
